<?php

declare (strict_types=1);

namespace App\Models\GameDB\Frag;

use Illuminate\Database\Eloquent\Model;

class PoolDrawRecord extends Model
{
    protected $connection = 'mysql_game';
    protected $table = 'lottery_frag_pool_draw_record';
    //protected $fillable = [];
    protected $guarded = [];

    //protected $casts = ['id' => 'int', 'user_id' => 'integer', 'amount' => 'integer', 'balance' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    public function one(array $filters)
    {
        return self::query()->where($filters)->first();
    }

    public function createData($data)
    {
        return self::query()->create($data);
    }

    public function getNotifyRecordList($notifyCoinValue, $count){
        return self::query()->select(['user_id', 'gift_id', 'gift_price', 'count'])
            ->where('gift_price', '>=', $notifyCoinValue)
            ->limit($count)->orderBy('id')->get();
    }
}
